package com.lyy.polymorphic.polyarr;


/**
 * @Author: GZQ
 * @date: 2024/11/19 23:12
 * @description: 多态数组里面的 子类 -- 学生类
 */


public class Student extends Person {
    private double score;

    public Student(String name, int age, double score) {
        super(name, age);
        this.score = score;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    // 重写父类的 say方法
    @Override
    public String say() {
        return "学生 " + super.say() + " score=" + score;
    }

    // 特有的方法
    public void study() {
        System.out.println("学生 " + getName() + " 正在学java");
    }
}
